// request
import { apiGetUser, apiRemoveUser } from '@/api/UserManagement/index'

export default {
  methods: {
    getUser() {
      this.tableLoading = true
      apiGetUser(this.formData).then(res => {
        // console.log('apiGetUser', res);
        const data = res.data || []
        this.pagination.total = res.totalRecords || 0
        this.tableData = Object.freeze(data)
        this.tableLoading = false
      })
        .catch(err => {
          console.log(err);
          this.tableData = []
          this.pagination.total = 0
          this.tableLoading = false
        })
    },


    removeUser(id) {
      apiRemoveUser(id).then(res => {
        console.log('removeUser', res);
        if (res && res.message) {
          this.$message.error(res.message)
        }
      })
        .catch(err => {
          // console.log(err);
          this.$message.success('删除成功')
          this.handleFormSubmit();
        })
    }
  }
}